package org.arpit.tutorial.ensemble;

/**

 * Copyright (c) 2008, 2012 Oracle and/or its affiliates.

 * All rights reserved. Use is subject to license terms.

 */

import javafx.application.Application;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.stage.Stage;

import javafx.geometry.Insets;

import javafx.geometry.Pos;

import javafx.scene.layout.GridPane;

import jfxtras.labs.scene.control.gauge.Odometer;

import jfxtras.labs.scene.control.gauge.OdometerBuilder;

 

 

/**

 * Odometer gauge.

 *

 * @see jxftras.labs.scene.control.gauge.Odometer

 */

public class OdometerGaugesSample extends Application {

    private Odometer odometer;

 

    private void init(Stage primaryStage) {

        Group root = new Group();

        primaryStage.setResizable(false);

        primaryStage.setScene(new Scene(root, 600,600));

 

        // Create some controls

        odometer = OdometerBuilder.create().interval(1000).noOfDecimals(0).build();

        odometer.setPrefSize(100, 100);

 

        // Layout

        final GridPane pane = new GridPane();

        pane.setPadding(new Insets(5));

        pane.setHgap(20);

        pane.setVgap(20);

        pane.setAlignment(Pos.TOP_CENTER);

 

        // Add controls to the layout

        pane.add(odometer, 1, 1);

 

        root.getChildren().add(pane);

    }

 

    //@Override

    public void play() {

        odometer.start();

    }

 

    @Override

    public void stop() {

        odometer.stop();

    }

 

    public double getSampleWidth() { return 600; }

 

    public double getSampleHeight() { return 600; }

 

    @Override 
    public void start(Stage primaryStage) throws Exception {

        init(primaryStage);

        primaryStage.show();

        play();

    }

    public static void main(String[] args) { launch(args); }

}